package gew.data;

public class SearchResultItem implements Comparable {

    private final String title;
    private final String description;
    private final String url;
    private final String section;
    private final int index;
    private final int score;

    public SearchResultItem(String title, String description, String url, String section, int index, int score) {
        this.title = title;
        this.description = description;
        this.url = url;
        this.section = section;
        this.index = index;
        this.score = score;
    }

    public String getTitle() {
        return title;
    }

    public String getDescription() {
        return description;
    }

    public String getUrl() {
        return url;
    }

    public String getSection() {
        return section;
    }

    public int getIndex() {
        return index;
    }

    public int getScore() {
        return score;
    }

    @Override
    public int compareTo(Object o) {
        int r = ((SearchResultItem) o).score - this.score;
        if (r == 0) {
            r = this.index - ((SearchResultItem) o).index;
        }
        return r;
    }

}
